import javax.swing.*;
import java.beans.*;
import java.util.*;
public class Configuraciones extends Observable implements Observer {

 	
 	 AgregarPrestatario agregarP;
 //AnularMultas anularM;
  BuscarMaterial buscarM;
  BuscarPrestatario buscarP;
  DevolverMaterial devolverM;
  EliminarPrestatario eliminarP;
  EliminarVolumen eliminarV;
  FichaMaterial fichaM;
  FichaPrestatario fichaP;
  IngresarNuevoMaterial ingresarM;
  ListarMultas listarM;
  ListarPrestamos listarP;
  PrestarMaterial prestarM;
  RenovarVolumen renovarV;
  ReservarMaterial reservarM;
  Login loginP;
  
  VerificadorPrestamos buscaAtrasos;
  desMultador desmulta;
   // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton12;
    private javax.swing.JButton jButton13;
    private javax.swing.JButton jButton14;
    private javax.swing.JButton jButton15;
    private javax.swing.JButton jButton16;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JComboBox jComboBox3;
    private javax.swing.JFrame jFrame1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JSpinner jSpinner1;
    private javax.swing.JSpinner jSpinner2;
    private javax.swing.JSpinner jSpinner3;
    private javax.swing.JSpinner jSpinner4;
    private javax.swing.JTabbedPane jTabbedPane1;
    // End of variables declaration//GEN-END:variables
  
   String ventanaObservada;
   JFrame ventanaPrincipal;
   JFrame ventanaConfiguraciones;
 
	 M_Configuraciones configuraciones;
 	M_Prestatario prestatario;
 	M_Material material;
 	cambiarUserPass cambiaUP;
 	int i,j,k;
 	public Configuraciones(){
 		configuraciones=new M_Configuraciones();
 		material=new M_Material();
 		prestatario=new M_Prestatario();
 		levantaVista();
 		
 		configuraciones.getDatos();
 		llenaVista();
 		
 	}   
    
    private void levantaVista() {
    	ventanaConfiguraciones=new JFrame();
       jLabel1 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jButton9 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jButton11 = new javax.swing.JButton();
        jButton12 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jSpinner1 = new javax.swing.JSpinner();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jSpinner2 = new javax.swing.JSpinner();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jSpinner3 = new javax.swing.JSpinner();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jSpinner4 = new javax.swing.JSpinner();
        jLabel10 = new javax.swing.JLabel();
        jButton7 = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jLabel15 = new javax.swing.JLabel();
        jComboBox3 = new javax.swing.JComboBox();
        jButton10 = new javax.swing.JButton();
        jButton13 = new javax.swing.JButton();
        jLabel16 = new javax.swing.JLabel();
        jComboBox2 = new javax.swing.JComboBox();
        jButton4 = new javax.swing.JButton();
        jButton14 = new javax.swing.JButton();
        jButton16 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();

        javax.swing.GroupLayout jFrame1Layout = new javax.swing.GroupLayout(ventanaConfiguraciones.getContentPane());
        ventanaConfiguraciones.getContentPane().setLayout(jFrame1Layout);
        jFrame1Layout.setHorizontalGroup(
            jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        jFrame1Layout.setVerticalGroup(
            jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        ventanaConfiguraciones.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        ventanaConfiguraciones.setResizable(false);
        jLabel1.setFont(new java.awt.Font("Arial", 1, 14));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Ventana Configuraci\u00f3n");
	    
	     
        //jButton9.setIcon(new javax.swing.ImageIcon("C:\\Users\\Reynaldo Musso\\Desktop\\iconos\\iconos\\show_offliners.png"));
        ImageIcon icon = new ImageIcon("images/administrator1_16x16.gif");
        jButton9.setIcon(icon);
        jButton9.setText("Prestatario");
        jButton9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton9.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton9.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        //jButton1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Reynaldo Musso\\Desktop\\iconos\\iconos\\identity.png"));
        ImageIcon icon1 = new ImageIcon("images/report2_16x16.gif");
        jButton1.setIcon(icon1);
        jButton1.setText("Material");
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton1.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        //jButton11.setIcon(new javax.swing.ImageIcon("C:\\Users\\Reynaldo Musso\\Desktop\\iconos\\iconos\\search_user.png"));
        ImageIcon icon2 = new ImageIcon("images/zoom_16x16.gif");
        jButton11.setIcon(icon2);
        jButton11.setText("Buscar");
        jButton11.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton11.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton11.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });

        //jButton12.setIcon(new javax.swing.ImageIcon("C:\\Users\\Reynaldo Musso\\Desktop\\New Folder\\settings1_16x16.gif"));
        ImageIcon icon3 = new ImageIcon("images/settings1_16x16.gif");
        jButton12.setIcon(icon3);
        jButton12.setText("Configuraci\u00f3n");
        jButton12.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton12.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton12.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton12ActionPerformed(evt);
            }
        });

        //jButton5.setIcon(new javax.swing.ImageIcon("C:\\Users\\Reynaldo Musso\\Desktop\\New Folder\\ordered_list_16x16.gif"));
         ImageIcon icon4 = new ImageIcon("images/ordered_list_16x16.gif");
        jButton5.setIcon(icon4);
        jButton5.setText("Multas en curso");
        jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton5.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        //jButton6.setIcon(new javax.swing.ImageIcon("C:\\Users\\Reynaldo Musso\\Desktop\\New Folder\\script_(start)_16x16.gif"));
        ImageIcon icon5 = new ImageIcon("images/script_(start)_16x16.gif");
        jButton6.setIcon(icon5);
        jButton6.setText("Prestamos en curso");
        jButton6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton6.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addComponent(jButton9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton12)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton6)
                .addContainerGap(20, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButton9)
                        .addComponent(jButton1))
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButton12, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jButton11)))
        );
		 ventanaConfiguraciones.pack();
        ventanaConfiguraciones.setVisible(true);

        jTabbedPane1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jLabel2.setFont(new java.awt.Font("Arial", 1, 12));
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("Editar configuraciones");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel3.setText("Dias maximos de reserva:");

        jLabel4.setFont(new java.awt.Font("Tahoma", 2, 11));
        jLabel4.setText("(Este es el numero de dias que durar\u00e1 la reserva de un volumen) ");

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel5.setText("Prestamos maximos por prersona:");

        jLabel6.setFont(new java.awt.Font("Tahoma", 2, 11));
        jLabel6.setText("(Este es el numero maximo de pretamos que puede realizar un prestatario en forma simultanea)");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel7.setText("Maximo de renovaciones:");

        jLabel8.setFont(new java.awt.Font("Tahoma", 2, 11));
        jLabel8.setText("(Este es el numero maximo de renovaciones por prestamo)");

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel9.setText("Dias de multa por dia de atraso:");

        jLabel10.setFont(new java.awt.Font("Tahoma", 2, 11));
        jLabel10.setText("(Dias en los cuales el prestatario no podr\u00e1 pedir prestamo)");
		
		 ImageIcon guardarcambiosicon = new ImageIcon("images/ok_16x16.gif");
        jButton7.setIcon(guardarcambiosicon);
        jButton7.setText("Guardar Cambios");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        jLabel11.setFont(new java.awt.Font("Arial", 1, 12));
        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel11.setText("de prestamos");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 486, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(16, 16, 16)
                                .addComponent(jLabel4))
                            .addComponent(jLabel5)
                            .addComponent(jLabel7)
                            .addComponent(jLabel9)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addComponent(jSpinner4, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel10))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addComponent(jSpinner3, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(jLabel8)))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(17, 17, 17)
                                .addComponent(jLabel6))
                            .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 486, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(219, 219, 219)
                        .addComponent(jButton7)))
                .addContainerGap(58, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel11)
                .addGap(8, 8, 8)
                .addComponent(jLabel3)
                .addGap(16, 16, 16)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addComponent(jLabel5)
                .addGap(19, 19, 19)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGap(21, 21, 21)
                .addComponent(jLabel7)
                .addGap(17, 17, 17)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jSpinner3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addGap(26, 26, 26)
                .addComponent(jLabel9)
                .addGap(14, 14, 14)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jSpinner4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                .addComponent(jButton7)
                .addGap(23, 23, 23))
        );
         ventanaConfiguraciones.pack();
        ventanaConfiguraciones.setVisible(true);
        
        ImageIcon tab1icon = new ImageIcon("images/table_(edit)_16x16.gif");
        jTabbedPane1.addTab("Prestamos",tab1icon, jPanel2);

        jLabel12.setFont(new java.awt.Font("Arial", 1, 12));
        jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel12.setText("Editar configuraciones");

        jLabel13.setFont(new java.awt.Font("Arial", 1, 12));
        jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel13.setText("de material y prestatario");

        jLabel14.setText("Tematicas del material:");

        jButton2.setText("Agregar nueva");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setText("Borrar seleccionado");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jLabel15.setText("Tipo del material:");

        jButton10.setText("Agregar nuevo");
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });

        jButton13.setText("Borrar seleccionado");
        jButton13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton13ActionPerformed(evt);
            }
        });

        jLabel16.setText("Tipos de prestatario:");

        jButton4.setText("Agregar nuevo");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jButton14.setText("Borrar seleccionado");
        jButton14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton14ActionPerformed(evt);
            }
        });

        jButton16.setText("Cambiar nombre de usuario y contrase\u00f1a...");
        jButton16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton16ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel14)
                                .addComponent(jLabel15)
                                .addComponent(jLabel16)
                                .addGroup(jPanel3Layout.createSequentialGroup()
                                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(32, 32, 32)
                                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jButton2)
                                        .addComponent(jButton10)
                                        .addComponent(jButton4))
                                    .addGap(57, 57, 57)
                                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jButton14)
                                        .addComponent(jButton13)
                                        .addComponent(jButton3))))
                            .addContainerGap(81, Short.MAX_VALUE))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 486, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 486, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(27, 27, 27)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addComponent(jButton16)
                        .addGap(152, 152, 152))))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel12)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel13)
                .addGap(17, 17, 17)
                .addComponent(jLabel14)
                .addGap(14, 14, 14)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton2)
                    .addComponent(jButton3))
                .addGap(26, 26, 26)
                .addComponent(jLabel15)
                .addGap(21, 21, 21)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton10)
                    .addComponent(jButton13))
                .addGap(36, 36, 36)
                .addComponent(jLabel16)
                .addGap(24, 24, 24)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton4)
                    .addComponent(jButton14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
                .addComponent(jButton16)
                .addGap(26, 26, 26))
        );
        ImageIcon tab2icon = new ImageIcon("images/database_table_16x16.gif");
        jTabbedPane1.addTab("Material y Prestatario",tab2icon, jPanel3);
		
		 ImageIcon volvericon = new ImageIcon("images/left_16x16.gif");
        jButton8.setIcon(volvericon);
        jButton8.setText("Volver");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(ventanaConfiguraciones.getContentPane());
        ventanaConfiguraciones.getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(140, Short.MAX_VALUE)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 422, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(72, 72, 72))
            .addGroup(layout.createSequentialGroup()
                .addGap(279, 279, 279)
                .addComponent(jButton8)
                .addContainerGap(292, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 595, Short.MAX_VALUE)
                .addGap(20, 20, 20))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(40, 40, 40)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 420, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(38, 38, 38)
                .addComponent(jButton8)
                .addContainerGap(37, Short.MAX_VALUE))
        );
         ventanaConfiguraciones.pack();
        ventanaConfiguraciones.setVisible(true);
       
    
    
    }
   
	//volver
    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
		this.setChanged();
		this.notifyObservers(); 
		ventanaConfiguraciones.dispose();
    }
      private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {
		this.setChanged();
		this.notifyObservers(); 
		ventanaConfiguraciones.dispose();
    }
	//cambiar nombre de usuario y contraseña
    private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {
	cambiaUP = new cambiarUserPass();
	cambiaUP.addObserver(this);
	ventanaConfiguraciones.setVisible(false);
    }
	
	//borrar seleccionado tipo usel
    private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {
	if(prestatario.eliminarTipoPrestatario(prestatario.codigosTiposPrestatarios[jComboBox2.getSelectedIndex()])){
	
		JOptionPane.showMessageDialog(ventanaConfiguraciones,
	    	"El tipo de prestatario seleccionado ha sido eliminado correctamente.",
	    	"Aviso",
	    	JOptionPane.WARNING_MESSAGE);  
	   jButton8.doClick();//no he encontrado la forma de actualizar los jcombobox sin errores.
	}else{
	
	    JOptionPane.showMessageDialog(ventanaConfiguraciones,
	    	"El tipo de prestatario seleccionado no puede ser eliminado debido a que esta en uso\npor uno o mas prestatarios existentes.",
	    	"Aviso",
	    	JOptionPane.WARNING_MESSAGE);  
    }
    }
	
	//agregar nuevo tipo user
    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
	System.out.println("agregar nuevo tipo user");
     boolean salir=true;
     do{
     	
     String nombre=	JOptionPane.showInputDialog(
                    ventanaConfiguraciones,
                    "Ingrese el nombre del tipo de prestatario:",
                    "Informacion",
                    JOptionPane.PLAIN_MESSAGE
                    );
     System.out.println(nombre);   
     if(nombre==null||nombre.equals("")){
     	JOptionPane.showMessageDialog(ventanaConfiguraciones,
    	"El nombre no puede estar vacio.",
    	"Aviso",
    	JOptionPane.WARNING_MESSAGE);
     	break;
     }               
              
    
	 String descripcion=	JOptionPane.showInputDialog(
                    ventanaConfiguraciones,
                    "Ingrese la descripcion del tipo de prestatario:",
                    "Informacion",
                    JOptionPane.PLAIN_MESSAGE
                    );
       System.out.println(descripcion);              
     if(descripcion==null||descripcion.equals("")){
     	JOptionPane.showMessageDialog(ventanaConfiguraciones,
    	"La descripcion no puede estar vacia.",
    	"Aviso",
    	JOptionPane.WARNING_MESSAGE);
     	break;
     }              
     prestatario.agregarTipoPrestatario(nombre,descripcion);
      	JOptionPane.showMessageDialog(ventanaConfiguraciones,
    	"El nuevo tipo de prestatario ha sido agregado correctamente.",
    	"Aviso",
    	JOptionPane.WARNING_MESSAGE);    
          
      
       jButton8.doClick();//no he encontrado la forma de actualizar los jcombobox sin errores.
          
     salir=false;        
    }while(salir);
    
    
    }
	
	//borrar seleccionado tipo material
    private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {
	
	if(material.eliminarTipoMaterial(material.idTiposMateriales[jComboBox3.getSelectedIndex()])){
	
	JOptionPane.showMessageDialog(ventanaConfiguraciones,
    	"El tipo de material seleccionado ha sido eliminado correctamente.",
    	"Aviso",
    	JOptionPane.WARNING_MESSAGE);   
    	jButton8.doClick();//no he encontrado la forma de actualizar los jcombobox sin errores.
    }else{
   
    JOptionPane.showMessageDialog(ventanaConfiguraciones,
    	"El tipo de material seleccionado no puede ser eliminado debido a que esta en uso\npor uno o mas materiales existentes.",
    	"Aviso",
    	JOptionPane.WARNING_MESSAGE);   
	 }
    }
	
	//agregar nuevo tipo material
    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {
	 boolean salir=true;
     do{
     	
     String nombre=	JOptionPane.showInputDialog(
                    ventanaConfiguraciones,
                    "Ingrese el nombre del tipo de material:",
                    "Informacion",
                    JOptionPane.PLAIN_MESSAGE
                    );
     System.out.println(nombre);   
     if(nombre==null||nombre.equals("")){
     	JOptionPane.showMessageDialog(ventanaConfiguraciones,
    	"El nombre no puede estar vacio.",
    	"Aviso",
    	JOptionPane.WARNING_MESSAGE);
     	break;
     }               
              
    
	 String descripcion=	JOptionPane.showInputDialog(
                    ventanaConfiguraciones,
                    "Ingrese la descripcion del tipo de material:",
                    "Informacion",
                    JOptionPane.PLAIN_MESSAGE
                    );
                    
     if(descripcion==null||descripcion.equals("")){
     	JOptionPane.showMessageDialog(ventanaConfiguraciones,
    	"La descripcion no puede estar vacia.",
    	"Aviso",
    	JOptionPane.WARNING_MESSAGE);
     	break;
     }
     
     boolean prestable;
     
     int i=JOptionPane.showConfirmDialog(ventanaConfiguraciones,"¿Desea que el tipo de material sea prestable (fuera de biblioteca)?","Consulta",JOptionPane.YES_NO_OPTION) ;
     
     if(i==0) 
     	prestable=true;
     else if(i==1)
     	prestable=false;
     else
     	break;
     
     
     i=JOptionPane.showConfirmDialog(ventanaConfiguraciones,"¿El tipo de material tiene titulo y autor (como un libro)?","Consulta",JOptionPane.YES_NO_OPTION) ;
     boolean info; 
     if(i==0) 
     	info=true;
     else if(i==1)
     	info=false;
     else 
     	break;
     
                   
   
      material.agregarTipoMaterial(nombre,descripcion,prestable,info);    
      JOptionPane.showMessageDialog(ventanaConfiguraciones,
    	"El nuevo tipo de material ha sido agregado correctamente.",
    	"Aviso",
    	JOptionPane.WARNING_MESSAGE);   
    	jButton8.doClick();//no he encontrado la forma de actualizar los jcombobox sin errores.    
     salir=false;        
    }while(salir);
    
    }
	
	//borrar tematica seleccionada
    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
	if(material.eliminarMaterialTematica(material.idTematicasMateriales[jComboBox1.getSelectedIndex()])){
	
		JOptionPane.showMessageDialog(ventanaConfiguraciones,
	    	"La tematica de material seleccionada ha sido eliminada correctamente.",
	    	"Aviso",
	    	JOptionPane.WARNING_MESSAGE);  
	    	jButton8.doClick();//no he encontrado la forma de actualizar los jcombobox sin errores. 
	}else{
	
	    JOptionPane.showMessageDialog(ventanaConfiguraciones,
	    	"La tematica de material seleccionada no puede ser eliminada debido a que esta en uso\npor uno o mas materiales existentes.",
	    	"Aviso",
	    	JOptionPane.WARNING_MESSAGE);   
    }
    }
	
	//agregar nueva tematica
    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
		 boolean salir=true;
     do{

     	
     String nombre=	JOptionPane.showInputDialog(
                    ventanaConfiguraciones,
                    "Ingrese el nombre de la tematica de material:",
                    "Informacion",
                    JOptionPane.PLAIN_MESSAGE
                    );
     System.out.println(nombre);   
     if(nombre==null||nombre.equals("")){
     	JOptionPane.showMessageDialog(ventanaConfiguraciones,
    	"El nombre no puede estar vacio.",
    	"Aviso",
    	JOptionPane.WARNING_MESSAGE);
     	break;
     }   
     
     String codigo=	JOptionPane.showInputDialog(
                    ventanaConfiguraciones,
                    "Ingrese el codigo de la tematica de material:",
                    "Informacion",
                    JOptionPane.PLAIN_MESSAGE
                    );
     System.out.println(nombre);   
     if(nombre==null||nombre.equals("")){
     	JOptionPane.showMessageDialog(ventanaConfiguraciones,
    	"El codigo no puede estar vacio.",
    	"Aviso",
    	JOptionPane.WARNING_MESSAGE);
     	break;
     }             
              
    
	 String descripcion=	JOptionPane.showInputDialog(
                    ventanaConfiguraciones,
                    "Ingrese la descripcion de la tematica de material:",
                    "Informacion",
                    JOptionPane.PLAIN_MESSAGE
                    );
                    
     if(descripcion==null||descripcion.equals("")){
     	JOptionPane.showMessageDialog(ventanaConfiguraciones,
    	"La descripcion no puede estar vacia.",
    	"Aviso",
    	JOptionPane.WARNING_MESSAGE);
     	break;
     }
     
    material.agregarMaterialTematica(codigo+" - "+nombre,descripcion);    
        JOptionPane.showMessageDialog(ventanaConfiguraciones,
    	"La nueva tematica de material ha sido agregada correctamente.",
    	"Aviso",
    	JOptionPane.WARNING_MESSAGE);   
    	jButton8.doClick();//no he encontrado la forma de actualizar los jcombobox sin errores.     
     salir=false;        
    }while(salir);
    
    }
	
	//Guardar datos
    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
	configuraciones.setDatos(Integer.parseInt(jSpinner1.getValue().toString()),Integer.parseInt(jSpinner2.getValue().toString()),Integer.parseInt(jSpinner3.getValue().toString()),Integer.parseInt(jSpinner4.getValue().toString()));
    JOptionPane.showMessageDialog(ventanaConfiguraciones,
    	"Los datos se han actualizado correctamente.",
    	"Aviso",
    	JOptionPane.WARNING_MESSAGE);
    }
    
    
   
   
    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_jButton9ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_jButton11ActionPerformed

    private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_jButton12ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_jButton6ActionPerformed
    
    

    public static void main(String args[]) {
     Configuraciones c=new Configuraciones();
     
    }
    
    
    private void llenaVista(){
   
    jSpinner1.setValue(configuraciones.diasPrestamo);
    jSpinner2.setValue(configuraciones.prestamosMax);
    jSpinner3.setValue(configuraciones.renovacionesMax);
    jSpinner4.setValue(configuraciones.diasMultaPorAtraso);
	llenaComboBox();
	
	System.out.println("LLENADA");
    	
    }

 	private void llenaComboBox(){
	
		
		
		
		try{
			material.getTiposMateriales();
			material.getCategorias();
			prestatario.getTiposPrestatarios();
			jComboBox3.removeAllItems();
			for( i=0;i<material.numeroTiposMateriales;i++){
		    	jComboBox3.insertItemAt(material.tiposMateriales[i],i);
		       
		    }
		    jComboBox1.removeAllItems();
		    for( j=0;j<material.numeroTematicasMateriales;j++){
		    	jComboBox1.insertItemAt(material.tematicasMateriales[j],j);
		    	
		    }
		    jComboBox2.removeAllItems();
		    for( k=0;k<prestatario.numeroTiposPrestatarios;k++){
		    	jComboBox2.insertItemAt(prestatario.tiposPrestatarios[k],k);
		    	
		    }
		jComboBox1.setSelectedIndex(0);
		jComboBox2.setSelectedIndex(0);
		jComboBox3.setSelectedIndex(0);	
		    
	    }catch(Exception e){}
	    
	    
		
	}
    
    
public void update( Observable obs,Object obj ) {
      
      	ventanaConfiguraciones.setVisible(true);
   		
      
      
      }



}